1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module shumate.RasterRenderer;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import shumate.DataSource;
31 private import shumate.MapSource;
32 private import shumate.c.functions;
33 public  import shumate.c.types;
34 
35 
36 /** */
37 public class RasterRenderer : MapSource
38 {
39 	/** the main Gtk struct */
40 	protected ShumateRasterRenderer* shumateRasterRenderer;
41 
42 	/** Get the main Gtk struct */
43 	public ShumateRasterRenderer* getRasterRendererStruct(bool transferOwnership = false)
44 	{
45 		if (transferOwnership)
46 			ownedRef = false;
47 		return shumateRasterRenderer;
48 	}
49 
50 	/** the main Gtk struct as a void* */
51 	protected override void* getStruct()
52 	{
53 		return cast(void*)shumateRasterRenderer;
54 	}
55 
56 	/**
57 	 * Sets our main struct and passes it to the parent class.
58 	 */
59 	public this (ShumateRasterRenderer* shumateRasterRenderer, bool ownedRef = false)
60 	{
61 		this.shumateRasterRenderer = shumateRasterRenderer;
62 		super(cast(ShumateMapSource*)shumateRasterRenderer, ownedRef);
63 	}
64 
65 
66 	/** */
67 	public static GType getType()
68 	{
69 		return shumate_raster_renderer_get_type();
70 	}
71 
72 	/**
73 	 * Creates a new [class@RasterRenderer] that uses the given data source.
74 	 *
75 	 * Params:
76 	 *     dataSource = a [class@DataSource] to provide tile image data
77 	 *
78 	 * Returns: a newly constructed [class@RasterRenderer]
79 	 *
80 	 * Throws: ConstructionException GTK+ fails to create the object.
81 	 */
82 	public this(DataSource dataSource)
83 	{
84 		auto __p = shumate_raster_renderer_new((dataSource is null) ? null : dataSource.getDataSourceStruct());
85 
86 		if(__p is null)
87 		{
88 			throw new ConstructionException("null returned by new");
89 		}
90 
91 		this(cast(ShumateRasterRenderer*) __p, true);
92 	}
93 
94 	/**
95 	 * Creates a new [class@RasterRenderer] that fetches tiles from the given URL
96 	 * using a [class@TileDownloader] data source.
97 	 *
98 	 * Equivalent to:
99 	 *
100 	 * ```c
101 	 * g_autoptr(ShumateTileDownloader) source = shumate_tile_downloader_new (url_template);
102 	 * ShumateRasterRenderer *renderer = shumate_raster_renderer_new (source);
103 	 * ```
104 	 *
105 	 * Params:
106 	 *     urlTemplate = a URL template to fetch tiles from
107 	 *
108 	 * Returns: a newly constructed [class@RasterRenderer]
109 	 *
110 	 * Throws: ConstructionException GTK+ fails to create the object.
111 	 */
112 	public this(string urlTemplate)
113 	{
114 		auto __p = shumate_raster_renderer_new_from_url(Str.toStringz(urlTemplate));
115 
116 		if(__p is null)
117 		{
118 			throw new ConstructionException("null returned by new_from_url");
119 		}
120 
121 		this(cast(ShumateRasterRenderer*) __p, true);
122 	}
123 
124 	/**
125 	 * Creates a new [class@RasterRenderer] with the given details and a data
126 	 * source.
127 	 *
128 	 * Params:
129 	 *     id = the map source's id
130 	 *     name = the map source's name
131 	 *     license = the map source's license
132 	 *     licenseUri = the map source's license URI
133 	 *     minZoom = the map source's minimum zoom level
134 	 *     maxZoom = the map source's maximum zoom level
135 	 *     tileSize = the map source's tile size (in pixels)
136 	 *     projection = the map source's projection
137 	 *     dataSource = a [class@DataSource] to provide tile image data
138 	 *
139 	 * Returns: a newly constructed [class@RasterRenderer]
140 	 *
141 	 * Throws: ConstructionException GTK+ fails to create the object.
142 	 */
143 	public this(string id, string name, string license, string licenseUri, uint minZoom, uint maxZoom, uint tileSize, ShumateMapProjection projection, DataSource dataSource)
144 	{
145 		auto __p = shumate_raster_renderer_new_full(Str.toStringz(id), Str.toStringz(name), Str.toStringz(license), Str.toStringz(licenseUri), minZoom, maxZoom, tileSize, projection, (dataSource is null) ? null : dataSource.getDataSourceStruct());
146 
147 		if(__p is null)
148 		{
149 			throw new ConstructionException("null returned by new_full");
150 		}
151 
152 		this(cast(ShumateRasterRenderer*) __p, true);
153 	}
154 
155 	/**
156 	 * Creates a new [class@RasterRenderer] with the given details and a data
157 	 * source.
158 	 *
159 	 * Params:
160 	 *     id = the map source's id
161 	 *     name = the map source's name
162 	 *     license = the map source's license
163 	 *     licenseUri = the map source's license URI
164 	 *     minZoom = the map source's minimum zoom level
165 	 *     maxZoom = the map source's maximum zoom level
166 	 *     tileSize = the map source's tile size (in pixels)
167 	 *     projection = the map source's projection
168 	 *     urlTemplate = a URL template to fetch tiles from
169 	 *
170 	 * Returns: a newly constructed [class@RasterRenderer]
171 	 *
172 	 * Throws: ConstructionException GTK+ fails to create the object.
173 	 */
174 	public this(string id, string name, string license, string licenseUri, uint minZoom, uint maxZoom, uint tileSize, ShumateMapProjection projection, string urlTemplate)
175 	{
176 		auto __p = shumate_raster_renderer_new_full_from_url(Str.toStringz(id), Str.toStringz(name), Str.toStringz(license), Str.toStringz(licenseUri), minZoom, maxZoom, tileSize, projection, Str.toStringz(urlTemplate));
177 
178 		if(__p is null)
179 		{
180 			throw new ConstructionException("null returned by new_full_from_url");
181 		}
182 
183 		this(cast(ShumateRasterRenderer*) __p, true);
184 	}
185 }